/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.ebc.icontatos.model;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

/**
 *
 * @author linux
 */
@Entity
public class MidiaSocial implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long idMidiaSocial;

    private String nomeMidia;

    private String enderecoMidia;
    
    @ManyToOne
    private Usuario usuario;

	public MidiaSocial() {
	}

	public Long getIdMidiaSocial() {
		return idMidiaSocial;
	}

	public void setIdMidiaSocial(Long idMidiaSocial) {
		this.idMidiaSocial = idMidiaSocial;
	}

	public String getNomeMidia() {
		return nomeMidia;
	}

	public void setNomeMidia(String nomeMidia) {
		this.nomeMidia = nomeMidia;
	}

	public String getEnderecoMidia() {
		return enderecoMidia;
	}

	public void setEnderecoMidia(String enderecoMidia) {
		this.enderecoMidia = enderecoMidia;
	}
	
	public Usuario getUsuario() {
		return usuario;
	}

	public void setUsuario(Usuario usuario) {
		this.usuario = usuario;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result	+ ((enderecoMidia == null) ? 0 : enderecoMidia.hashCode());
		result = prime * result	+ ((idMidiaSocial == null) ? 0 : idMidiaSocial.hashCode());
		result = prime * result	+ ((nomeMidia == null) ? 0 : nomeMidia.hashCode());
		result = prime * result + ((usuario == null) ? 0 : usuario.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		MidiaSocial other = (MidiaSocial) obj;
		if (enderecoMidia == null) {
			if (other.enderecoMidia != null)
				return false;
		} else if (!enderecoMidia.equals(other.enderecoMidia))
			return false;
		if (idMidiaSocial == null) {
			if (other.idMidiaSocial != null)
				return false;
		} else if (!idMidiaSocial.equals(other.idMidiaSocial))
			return false;
		if (nomeMidia == null) {
			if (other.nomeMidia != null)
				return false;
		} else if (!nomeMidia.equals(other.nomeMidia))
			return false;
		if (usuario == null) {
			if (other.usuario != null)
				return false;
		} else if (!usuario.equals(other.usuario))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "MidiaSocial [idMidiaSocial=" + idMidiaSocial + "]";
	}

}
